package com.learning.dubbo.service.mock.provider;

import com.learning.dubbo.service.mock.api.GreetingsService;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * ClassName: Consumer
 * Description: 消费客户端
 * Date: 2020/6/15 13:43 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class GreetingsServiceImpl implements GreetingsService {

    private AtomicInteger count = new AtomicInteger(0);

    @Override
    public String sayHi(String name) {
        return "hi, " + name;
    }


    @Override
    public String sayHello(String name) {
        System.out.println(count.addAndGet(1));
        try {
            // 模拟业务时间
            Thread.sleep(20000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "hi, " + name;
    }
}